import 'package:flutter/material.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:get/get.dart';
import 'package:sgy_flutter/widget/app_bar_x.dart';
import 'package:sgy_flutter/widget/sgy_scaffold.dart';
import 'package:webview_flutter/webview_flutter.dart';

import '../../widget/fading_circle.dart';
import 'logic.dart';

class HelpPage extends StatefulWidget {
  const HelpPage({Key? key}) : super(key: key);

  @override
  State<HelpPage> createState() => _HelpPageState();
}

class _HelpPageState extends State<HelpPage> {
  final logic = Get.put(HelpLogic());

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBarX(
        title: Text('没有发现我的设备'.tr),
      ),
      body: Stack(
        children: [
          WebViewWidget(controller: logic.controller),
          Obx(
            () => Visibility(
              visible: logic.loading.value,
              child: Center(
                child: FadingCircle(
                  color: Get.theme.primaryColor,
                  size: 120.0,
                ),
              ),
            ),
          ),
        ],
      ),
    );
  }

  @override
  void dispose() {
    Get.delete<HelpLogic>();
    super.dispose();
  }
}
